package com.zg.api.sys;

import com.zg.common.core.exception.IException;

/**
 * <p>Description: </p>
 *
 * @author zhanfeng.liang
 * @since 2025/5/21 16:40
 */

public enum ApiE implements IException {

    PROJECT_NOT_NULL(00001, "项目不能为空"),
    PROJECT_IS_EXIST(00002, "项目编号已存在"),
    PROJECT_IS_NAMESPACE(00003, "项目已同步到命名空间"),

    SERVICE_NOT_NULL(10001, "服务不能为空"),
    SERVICE_IS_EXIST(10002, "服务编号已存在"),

    CATEGORY_NOT_NULL(20001, "接口分类不能为空"),
    CATEGORY_IS_EXIST(20002, "接口分类已存在"),

    API_NAME_IS_EXIST(30001, "接口名称已存在"),
    API_CODE_IS_EXIST(30002, "接口编号已存在"),
    ;

    private Integer code;
    private String msg;

    ApiE(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Integer getCode() {
        String s =Constants.SYS_CODE + String.format("%05d", this.code);
        return  Integer.valueOf(s);
    }

    @Override
    public String getMsg() {
        return this.msg;
    }
}
